<template>
  <!-- 选择试题类型 -->
  <el-select
    v-model="value"
    style="width: 100%"
    :placeholder="placeholder"
    :disabled="disabled"
    :size="size"
    clearable
    @change="handleChange"
  >
    <el-option
      v-for="v in qusetionType"
      :key="v.value"
      :label="v.label"
      :value="v.value"
    ></el-option>
  </el-select>
</template>
<script>
import { qusetionType } from './data'
export default {
  data() {
    return {
      value: '',
      qusetionType,
    }
  },
  props: {
    defaultValue: String,
    disabled: {
      type: Boolean,
      default: false,
    },
    size: {
      type: String,
      default: '',
    },
    placeholder: {
      type: String,
      default: '请选择试题类型',
    },
  },
  watch: {
    defaultValue: {
      immediate: true,
      handler(v) {
        this.value = v
      },
    },
  },
  methods: {
    handleChange(value) {
      this.$emit('emit', value)
    },
  },
}
</script>